<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>求数组中的最大偶数</title>
</head>

<body>
  <script>
    var a = [1, 2, 10, 20]
    var max = 0
    for (i = 0; i < a.length; i++) {
      if (a[i] % 2 == 0) {

      }
      if (a[i] > max) {
        max = a[i]
      }
    }
    console.log(max);

  </script>
</body>

</html>